package com.wjx.demo.collection

class B(a: Int, b: String)

fun main(args: Array<String>) {
    var b1 = B(1, "a")
    var b2 = B(2, "b")
    var b3 = B(3, "c")
    val m1 = mapOf<Int, B>(1 to b1, 2 to b2, 3 to b3)
    println(m1)

    var m2 = mutableMapOf(Pair(1, b1), Pair(2, b2), Pair(3, b3))
    println(m2)

    hashMapOf<Int, B>(1 to b1);  //hashMap  不支持 TreeMap

    m2.keys.forEach(::print)
    m2.values.forEach(::print)
    println()
    m2.entries.filter { x -> x.key > 1 }.forEach { it -> println(it.key) }
}
